package models;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;


import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import org.joda.time.Duration;
import org.joda.time.LocalDate;
import org.joda.time.LocalTime;

import play.db.jpa.Model;
import siena.Table;
import siena.embed.Embedded;


@Table("course_sections")
public class CourseSection extends BasicModel implements Schedulable {

	public Course course;
	
	public School school;

	public List<Enrollment> enrollments = new ArrayList<Enrollment>();
	
	@Enumerated(EnumType.STRING)
	public GradingMethod gradingMethod;

	@Embedded
	public EventSchedule schedule;

	public CourseSection(Course course, EventSchedule schedule) {
		super(course.title);
		this.course = course;
		this.schedule = schedule;
	}

	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).append(
				course).append(schedule).toString();
	}

}
